import { stringify } from 'qs';
import request from '../utils/request';
// 注册
export function registerAction(data) {
  return request('/user/register', {
    method: 'post',
    body: data
  });
}

// 登录
export function loginAction (data) {
  return request('/user/login', {
    method: 'post',
    body: data
  });
}

// 获取当前登录用户信息
export function getCurrentUserAction () {
  return request('/user/currentUser');
}
// 更新当前登录用户信息
export function updateCurrentUserAction (data) {
  return request('/user/updateCurrentUser', {
    method: 'put',
    body: data
  });
}

// 获取对应的成员列表
export function getMemberListAction (data) {
  return request(`/user/getMemberList${stringify(data, { addQueryPrefix: true })}`);
}
// 退出登录
export function logoutAction () {
  return request('/user/logout', {
    method: 'post'
  });
}
// 获取被发送者的信息
export function getSendedUserInfoAction (data) {
  return request(`/user/getSendedUserInfo${stringify(data, { addQueryPrefix: true })}`);
}
// 更新被发送者的信息
export function updateSendedUserInfoAction (data) {
  return request('/user/updateSendedUserInfo', {
    method: 'put',
    body: data
  });
}